package com.ruoyi.common.enums.comlbs;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor;

/**
 * 监管类型
 */
@NoArgsConstructor
@AllArgsConstructor
@Getter
public enum ObjectTypeEnum implements DataEnum{

    VEHICLE(0, "车辆"),
    SHIP(1, "船舶"),
    PERSON(2, "人员"),
    ARTICLE(3, "物品"),
    ANIMALS(4, "动物"),
    OTHERS(5, "其他"),
    ;

    private int code;
    private String text;

    @JsonCreator
    public static ObjectTypeEnum fromInt(Integer code) {
        return DataEnum.getEnum(ObjectTypeEnum.class, code);
    }

    @JsonCreator
    public static ObjectTypeEnum fromString(String text) {
        return DataEnum.getEnum(ObjectTypeEnum.class, text);
    }

    @Override
    @JsonValue
    public Integer getCode() {
        return code;
    }
}
